package com.isoftstone.merchant.service.mdept.impl;

import com.isoftstone.merchant.dao.mdept.SysUserDeptMapper;
import com.isoftstone.merchant.entity.mdept.MDept;
import com.isoftstone.merchant.entity.mdept.SysUserDept;
import com.isoftstone.merchant.service.mdept.ISysUserDeptService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
public class SysUserDeptService implements ISysUserDeptService {

    @Autowired
    SysUserDeptMapper sysUserDeptMapper;
    @Override
    public int insert(SysUserDept record) {
        return 0;
    }

    @Override
    public int insertSelective(SysUserDept record) {
        return 0;
    }

    @Override
    @Transactional
    public void updateUserDeptByUserIdAndDeptId(String userid,String deptid) throws Exception {
        sysUserDeptMapper.addUserDept(userid, deptid);
    }

    @Override
    @Transactional
    public List<SysUserDept> getUserDeptByUserId(String userId) throws Exception {
        return sysUserDeptMapper.getUserDeptByUserId(userId);
    }

    @Override
    @Transactional
    public void deleteUserDeptBydeptId(String deptid) throws Exception {
        sysUserDeptMapper.deleteUserDeptBydeptId(deptid);
    }

    @Override
    public List<String> getDeptIdByUserId(String userid) throws Exception {
        return sysUserDeptMapper.getDeptIdByUserId(userid);
    }

    @Override
    public void deleteUserDeptByUserId(String userid) throws Exception {
        sysUserDeptMapper.getDeptIdByUserId(userid);
    }

    @Override
    public List<SysUserDept> getDeptIdAndNameByUserId(String userid) throws Exception {
        return sysUserDeptMapper.getDeptIdAndNameByUserId(userid);
    }
}
